postgresql_psycopg2 = {
'hour' : 
u"""
SELECT
    COUNT(1),
    date_part('hour', time)
FROM simplestats_pageview
WHERE to_char(time, 'YYYY-MM-DD') = '%s'
GROUP BY date_part('hour', time);
""",

'day' : 
u"""
SELECT
    COUNT(1),
    date_part('day', time)
FROM simplestats_pageview
WHERE to_char(time, 'YYYY-MM') = '%s'
GROUP BY date_part('day', time);
""",

'month' : 
u"""
SELECT
    COUNT(1),
    date_part('month', time)
FROM simplestats_pageview
WHERE to_char(time, 'YYYY') = '%s'
GROUP BY date_part('month', time);
""",

'year' : 
u"""
SELECT
    COUNT(1),
    date_part('year', time)
FROM simplestats_pageview
GROUP BY date_part('year', time);
""",
}

sqlite3 = {
'hour' : 
u"""
SELECT 
    count(1),
    strftime("%%%%H", time) as hour, 
    strftime("%%%%Y-%%%%m-%%%%d", time) as date
FROM simplestats_pageview
WHERE date = "%s"
GROUP BY hour;
""",

'day' : 
u"""
SELECT 
    count(1),
    strftime("%%%%d", time) as day, 
    strftime("%%%%Y-%%%%m", time) as month
FROM simplestats_pageview
WHERE month = "%s"
GROUP BY day;
""",

'month' : 
u"""
SELECT 
    count(1),
    strftime("%%%%m", time) as month, 
    strftime("%%%%Y", time) as year
FROM simplestats_pageview
WHERE year = "%s"
GROUP BY month;
""",

'year' : 
u"""
SELECT 
    count(1),
    strftime("%%%%Y", time) as year
FROM simplestats_pageview
GROUP BY year;
""",
}